package cn.net.wangyixinwen.api;

import java.util.List;
import java.util.Map;

import cn.net.wangyixinwen.bean.NewsBean;
import cn.net.wangyixinwen.bean.TypeNewsBean;
import cn.net.wangyixinwen.bean.VideoBean;
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.schedulers.Schedulers;

/**
 * 仓库
 */
public class ApiRepository {


    private static final ApiService apiService = RetrofitClientInstance.getInstance().create(ApiService.class);

    //
    public static Observable<Map<String, List<NewsBean>>> getHomeHead() {
        return apiService.getHome()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Map<String, List<NewsBean>>> getJX() {
        return apiService.getJX("http://c.3g.163.com/nc/article/list/T1467284926140/0-20.html")
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Map<String, List<NewsBean>>> getTypeList(String url) {
        return apiService.getTypeList(url)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<TypeNewsBean> getTypeList1(String url) {
        return apiService.getTypeList1(url)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }

    public static Observable<Map<String, List<VideoBean>>> getVideo() {
        return apiService.getVideo("http://c.m.163.com/recommend/getChanListNews?channel=T1457068979049&size=20")
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread());
    }


}
